package com.live.webvideo.common.easemob;

import net.sf.json.JSONObject;

/**
 * 环信注册
 *
 * @author wangdong
 * @date 2018/11/5 13:54
 */
public class HuanXinRegist {

    /**
     * 注册环信新用户
     * @param username 需要注册的用户名
     * @param password 需要注册的密码
     * @param nickName 需要注册的昵称
     * @return
     */
    public static boolean registerUser(String username, String password, String nickName) {

        try {
            JSONObject params = new JSONObject();
            params.put("username", username);
            params.put("password", password);
            params.put("nickname", nickName);

            int status = HttpTool.doPosts(HuanxinConstant.USERS_URL, params.toString(), GetAdminToken.getToken());
            if (status == 200) {
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            return false;
        }
    }
}
